{% extends 'base.html' %}
{% block content %}
<div class="container mt-4">
    <h2>传感器管理</h2>
    <div class="mb-3">
        <a href="{% url 'sensor-create' %}" class="btn btn-primary">添加传感器</a>
        <a href="{% url 'sensor-import-export' %}" class="btn btn-success">导入/导出</a>
    </div>
    
    <table class="table table-striped">
        <thead>
            <tr>
                <th>传感器名称</th>
                <th>设计编号</th>
                <th>所在位置</th>
                <th>传感器类型</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {% for sensor in sensors %}
            <tr>
                <td>{{ sensor.name }}</td>
                <td>{{ sensor.design_code }}</td>
                <td>{{ sensor.location }}</td>
                <td>{{ sensor.get_sensor_type_display }}</td>
                <td>{{ sensor.get_status_display }}</td>
                <td>
                    <a href="{% url 'sensor-update' sensor.pk %}" class="btn btn-sm btn-warning">编辑</a>
                    <a href="{% url 'sensor-delete' sensor.pk %}" class="btn btn-sm btn-danger">删除</a>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% endblock %}